package junit.text;

import java.util.Date;

import org.junit.Test;

import cn.itcast.domain.User;
import cn.itcast.exception.UserExistException;
import cn.itcast.service.impl.BusinessServiceImpl;

public class ServiceTest {
	@Test
	public void testRegister() {
		User user = new User();
		user.setBirthday(new Date());
		user.setEmail("aaa@qq.com");
		user.setId("21321421");
		user.setNicname("safa");
		user.setUsername("abc");
		user.setPassword("abc");
		
		BusinessServiceImpl service = new BusinessServiceImpl();	
		try {
			service.register(user);
			System.out.println("注册成功");
		} catch (UserExistException e) {
			// TODO Auto-generated catch block
			System.out.println("用户已存在");
		}
	}
	@Test
	public void loginTest() {
		BusinessServiceImpl service = new BusinessServiceImpl();
		User user = service.login("abc", "abc");
		System.out.println(user);
	}
}
